<!doctype html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Twitter“点赞”红心按钮CSS3动画特效|DEMO</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css" />
	<link rel="stylesheet" type="text/css" href="css/default.css">
	<link rel="stylesheet" type="text/css" href="css/style.css"/>
	<!--[if IE]>
		<script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
	<![endif]-->
</head>
<body>
	<article class="htmleaf-container">
		<header class="htmleaf-header">
			<h1>Twitter“点赞”红心按钮CSS3动画特效 <span>Twitter Heart Button CSS3 Animation</span></h1>
		</header>
		<div id="container">
			<h3>点击下面的红心查看效果！</h3>

			<div class="feed" id="feed2">
			<p>百度一下 <a href="https://www.baidu.com/" target="_blank">https://www.baidu.com</a></p>
			<div class="heart" id="like2" rel="like"></div> <div class="likeCount" id="likeCount2">10</div>
			</div>
		</div>
	</article>
	
	<script src="http://libs.useso.com/js/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>
	<script>window.jQuery || document.write('<script src="js/jquery-1.11.0.min.js"><\/script>')</script>
	<script>
	$(document).ready(function()
	{
    
	$('body').on("click",'.heart',function()
    {
    	
    	var A=$(this).attr("id");
    	var B=A.split("like");
        var messageID=B[1];
        var C=parseInt($("#likeCount"+messageID).html());
    	$(this).css("background-position","")
        var D=$(this).attr("rel");
       
        if(D === 'like') 
        {      
        $("#likeCount"+messageID).html(C+1);
        $(this).addClass("heartAnimation").attr("rel","unlike");
        
        }
        else
        {
        $("#likeCount"+messageID).html(C-1);
        $(this).removeClass("heartAnimation").attr("rel","like");
        $(this).css("background-position","left");
        }

    });


	});
	</script>
</body>
</html>